import request from '@/utils/request';

/**
 * 获取提现记录
 * @param params
 * @returns {AxiosPromise}
 */
export function getApplyListApi(params) {
  return request({
    url: '/api/userWithdrawals',
    method: 'GET',
    headers: {
      Accept: 'application/json'
    },
    params: Object.assign(params, { isGet: true })
  });
};

/**
 * 获取提现统计记录
 * @returns {AxiosPromise}
 */
export function getApplyBalanceApi() {
  return request({
    url: '/api/userWithdrawals/chart',
    method: 'GET',
    headers: {
      Accept: 'application/json'
    }
  });
};

/**
 * 审核指定提现记录
 * @param id ID
 * @param data 数据
 * @returns {AxiosPromise}
 */
export function postApplyStatusApi(id, data) {
  return request({
    url: `api/userWithdrawals/${id}/audit`,
    method: 'POST',
    data: data
  });
};

/**
 * 审核指定提现记录
 * @param id ID
 * @param data 数据
 * @returns {AxiosPromise}
 */
export function putApplyAuditApi(id, data) {
  return request({
    url: `api/userWithdrawals/${id}/audit`,
    method: 'POST',
    data
  });
};

/**
 * 获取指定提现记录
 * @param id
 * @returns {AxiosPromise}
 */
export function getAppointApplyListApi(id) {
  return request({
    url: `/api/userWithdrawals/${id}`,
    method: 'GET',
    headers: {
      Accept: 'application/json'
    }
  });
};

/**
 * 更新指定提现记录
 * @param id
 * @param data
 * @returns {AxiosPromise}
 */
export function putApplyCreatApi(id, data) {
  return request({
    url: `api/userWithdrawals/${id}`,
    method: 'PUT',
    data
  });
};

/**
 * 获取资金记录
 * @param params
 * @returns {AxiosPromise}
 */
export function getCapitalRecordsListApi(params) {
  return request({
    url: `api/userBills`,
    method: 'GET',
    headers: {
      Accept: 'application/json'
    },
    params: Object.assign(params, { isGet: true })
  });
};
